package BehaviorModel.commandModel;

public class CommandClientTest {

    public static void main(String[] args){
        CommandController commandController = new CommandController();
        // 电视
        TVReceive tvReceive = new TVReceive();
        Command tvOnCommand = new TVOnCommand(tvReceive);
        Command tvOffCommand = new TVOffCommand(tvReceive);
        commandController.setCommand(0,tvOnCommand,tvOffCommand);

        commandController.on(0);
        commandController.undo();
        commandController.off(0);
        commandController.undo();
        commandController.on(3);

        // 冰箱
        RefrigeratorReceive refrigeratorReceive = new RefrigeratorReceive();
        RefrigeratorOnCommand refrigeratorOnCommand = new RefrigeratorOnCommand(refrigeratorReceive);
        RefrigeratorOffCommand refrigeratorOffCommand = new RefrigeratorOffCommand(refrigeratorReceive);
        commandController.setCommand(1,refrigeratorOnCommand,refrigeratorOffCommand);
        commandController.on(1);
        commandController.undo();
        commandController.off(1);
        commandController.undo();
    }
}
